﻿using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Property_Info_Comparables : System.Web.UI.Page
{
    private int propertyId;
    private String pid;
    protected void Page_Load(object sender, EventArgs e)
    {
        Master.CurrentPage = Pages.Comps;
        propertyId = Master.PropertyID;
        LoadComps(DateTime.UtcNow.Subtract(TimeSpan.FromDays(365)), DateTime.Now ,false);
    }
    void LoadComps(DateTime start, DateTime end, bool foreclosures)
    {
        Property_Data pd = new Property_Data();
        DataSet dsGetCompsResults = pd.GetCompTransfers(propertyId,start,end,foreclosures);
        lvComps.DataSource = dsGetCompsResults;
        lvComps.DataBind();
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        LoadComps(DateTime.UtcNow.Subtract(TimeSpan.FromDays(float.Parse(rblDateRange.SelectedValue))), DateTime.Now, bool.Parse(rblSaleType.SelectedValue));
    }

    public string ConvertToText(object o)
    {
        int i = Convert.ToInt32(o);

        if (i == 1)
            return "Yes";

        else
            return "No";
    }
}
